Fix mass consistency for configured second-moon properties#4
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Keep a customized second moon's radius, bulk density, and dynamical mass internally consistent.
baseline.yamlexposesradius_kmanddensity_kg_m3, but_baseline_elements()supplies the package-defaultSECOND_MOON_MASS_KGregardless of those configured values. As a result, changing either bulk property could silently leave the N-body and saved-model mass at the original 838 km / 3344 kg m⁻³ value.This patch makes
OrbitalElementsenforce the invariant at the model boundary:spherical_mass_kg(radius_km, density_kg_m3)with finite-positive input validation.mass_kgwhen radius or density is customized while mass remains at the package default.Scientific impact
The checked-in baseline configuration is unchanged: 838 km and 3344 kg m⁻³ still produce the same
8.2430310159e21 kgmass, so published baseline outputs should not move.Alternate configurations that changed radius or density without also changing mass will now use the physically derived mass. That is the intended correction and may change their trajectories, stability results, tides, and eclipse catalogs.
Checklist
ruff check .passes — CI pendingpytestpasses — CI pending